'''
“一元任我行”交通工具意外险
'''
import sys

sys.path.append('../')
from db.mysql import MysqlClient
from common.helper import Helper
import json

class Spider(object):
    def __init__(self):
        self.mysql = MysqlClient()
        self.name = "“一元任我行”交通工具意外险"

    # 生成产品数据
    def genProductInfo(self):

        plan = {

            "飞机交通工具意外伤害身故、伤残":"5w",
            "火车交通工具意外伤害身故、伤残":"5w",
            "汽车交通工具意外伤害身故、伤残":"5w",
            "轮船交通工具意外伤害身故、伤残":"5w"

        }

        price = 0

        expire = "30天"

        plan = "'" + json.dumps( plan,ensure_ascii=False ) + "'"

        for i in range(1,11):


            max_num = i
            self.mysql.cursor.execute('INSERT INTO `“一元任我行”交通工具意外险`(`plan`,`max_num`,`expire`,`price`)VALUES({0},{1},"{2}","{3}")'.format( plan,max_num,expire,Helper.decimalParse(i)))
            self.mysql._conn.commit()




if __name__ == '__main__':
    s = Spider()

    s.genProductInfo()
